package com.ruoyi.net.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.net.domain.BusiSrtpElementVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.net.mapper.BusiSrtpElementMapper;
import com.ruoyi.net.domain.BusiSrtpElement;
import com.ruoyi.net.service.IBusiSrtpElementService;

/**
 * SR-TP单站（网元）业务Service业务层处理
 * 
 * @author tony
 * @date 2025-04-11
 */
@Service
public class BusiSrtpElementServiceImpl implements IBusiSrtpElementService 
{
    @Autowired
    private BusiSrtpElementMapper busiSrtpElementMapper;

    /**
     * 查询SR-TP单站（网元）业务
     * 
     * @param id SR-TP单站（网元）业务主键
     * @return SR-TP单站（网元）业务
     */
    @Override
    public BusiSrtpElement selectBusiSrtpElementById(String id)
    {
        return busiSrtpElementMapper.selectBusiSrtpElementById(id);
    }

    /**
     * 查询SR-TP单站（网元）业务列表
     * 
     * @param busiSrtpElement SR-TP单站（网元）业务
     * @return SR-TP单站（网元）业务
     */
    @Override
    public List<BusiSrtpElementVo> selectBusiSrtpElementList(BusiSrtpElement busiSrtpElement)
    {
        return busiSrtpElementMapper.selectBusiSrtpElementList(busiSrtpElement);
    }

    /**
     * 新增SR-TP单站（网元）业务
     * 
     * @param busiSrtpElement SR-TP单站（网元）业务
     * @return 结果
     */
    @Override
    public int insertBusiSrtpElement(BusiSrtpElement busiSrtpElement)
    {
        String uuid = IdUtils.simpleUUID();
        if (StringUtils.isEmpty(busiSrtpElement.getId())) {
            busiSrtpElement.setId(uuid);
        }
        busiSrtpElement.setCreateBy(SecurityUtils.getUsername());
        busiSrtpElement.setCreateTime(DateUtils.getNowDate());
        busiSrtpElement.setUpdateBy(SecurityUtils.getUsername());
        busiSrtpElement.setUpdateTime(DateUtils.getNowDate());
        busiSrtpElement.setCircuitDirection("1");//设置默认值
        return busiSrtpElementMapper.insertBusiSrtpElement(busiSrtpElement);
    }

    /**
     * 修改SR-TP单站（网元）业务
     * 
     * @param busiSrtpElement SR-TP单站（网元）业务
     * @return 结果
     */
    @Override
    public int updateBusiSrtpElement(BusiSrtpElement busiSrtpElement)
    {
        busiSrtpElement.setUpdateBy(SecurityUtils.getUsername());
        busiSrtpElement.setUpdateTime(DateUtils.getNowDate());
        return busiSrtpElementMapper.updateBusiSrtpElement(busiSrtpElement);
    }

    /**
     * 批量删除SR-TP单站（网元）业务
     * 
     * @param ids 需要删除的SR-TP单站（网元）业务主键
     * @return 结果
     */
    @Override
    public int deleteBusiSrtpElementByIds(String[] ids)
    {
        return busiSrtpElementMapper.deleteBusiSrtpElementByIds(ids);
    }

    /**
     * 删除SR-TP单站（网元）业务信息
     * 
     * @param id SR-TP单站（网元）业务主键
     * @return 结果
     */
    @Override
    public int deleteBusiSrtpElementById(String id)
    {
        return busiSrtpElementMapper.deleteBusiSrtpElementById(id);
    }

    @Override
    public BusiSrtpElementVo selectBusiSrtpElementVoById(String srtpSingleId) {
        return busiSrtpElementMapper.selectBusiSrtpElementVoById(srtpSingleId);
    }

    @Override
    public int updateBusiSrtpElementByParam(BusiSrtpElement busiSrtpElement) {
        return busiSrtpElementMapper.updateBusiSrtpElementByParam(busiSrtpElement);
    }
}
